feat: folder-based type inference + docs command#84
Conversation
Adds automatic node type assignment from folder structure when no type: field is present in frontmatter. Closes #73, #44. - inferTypeFromPath in util.ts: folder-name mode (case-insensitive leaf-dir matching against schema types and aliases) and folderMap mode (explicit path-to-type mapping, longest-prefix wins) - typeInference config block added to MarkdownPluginConfig - readSpaceDirectory wires in inference after field mapping - extractEntityInfo moved from command layer to schema/schema.ts with simplified signature; extractSchemaTypeNames added as thin wrapper - Tests cover all inference scenarios including folderMap edge cases - README and docs/concepts.md updated
- Add `ost-tools docs [topic]` command routing to README (default) or individual doc files (concepts, config, schema, rules) - Remove `readme` command - Create docs/config.md with full plugin config reference (fieldMap, typeInference, templateDir, filter views, plugin loading rules) - Ship docs/ files with package via package.json files field - Trim README plugin config sections to a single pointer line - Update SKILL.md: readme → docs, replace static plugin config list with `ost-tools docs config` pointer, clean up references section
|
Claude finished @mindsocket's task in 3m 30s —— View job Code ReviewI've completed reviewing this PR. Here's my analysis: SummaryThis PR implements two major features:
Overall Assessment: ✅ LGTM with minor suggestions The implementation is well-designed, thoroughly tested, and properly documented. The code follows the project's established patterns and conventions. Type Inference ImplementationStrengthsClean API design (
Good integration (
Schema refactor (
Comprehensive tests (
DocumentationNew
Docs Command ImplementationClean design (
Good packaging (
Documentation updates:
Hook Feedback: Linting WarningThe pre-stop hook detected a linting warning from biome: Fix: I've committed a change to add .miro-cache/
config.json
.claude/settings.local.json
.claude/worktrees/
+ .claude-pr/
CLAUDE.local.mdNote: I cannot push this fix due to GitHub Actions permissions. You'll need to manually add Test Results
Minor Suggestions for Future Enhancements
Test Plan StatusBased on my review:
ConclusionThis is a well-executed PR that addresses the requirements in issues #73, #44, and #78. The implementation is clean, well-tested, and properly documented. The type inference feature provides a nice quality-of-life improvement for users organizing their markdown files by type, and the docs command is a thoughtful replacement for the readme command. Recommendation: ✅ Approve (with .gitignore fix applied) |
- Skip review on draft PRs - Grant contents:write so Claude can push to PR branches - Add bun run typecheck to allowed tools in both workflows - Add .claude-pr/ to .gitignore
|
Claude finished @mindsocket's task in 1m 34s —— View job Code Review
|

Summary
readmecommand withdocs [topic]command; shipsdocs/files with the packageType inference (#73, #44)
Adds
typeInferenceconfig underplugins.markdown:mode: "folder-name"(default) — matches the leaf directory name case-insensitively against schema type names andtypeAliaseskeys. Files at the space root are never inferred.folderMap— explicit path → type mapping (longest-prefix match, trailing slashes normalised, values may be aliases). Unresolvable values throw a hard error at parse time.type:in frontmatter always wins over inferred type.extractEntityInfomoved from command layer tosrc/schema/schema.ts(cleaner API);extractSchemaTypeNamesadded as a thin wrapper returningSet<string>.Docs command
ost-tools docs→ README (replacesost-tools readme)ost-tools docs config→ plugin config referenceost-tools docs concepts/schema/rules→ respective doc filesdocs/config.mdcreated with the full plugin config reference (extracted from README)package.jsonfilesso they ship with the packageost-tools docs configpointerTest plan
bun run test— 391 tests passbun run typecheck— cleanost-tools docsrenders READMEost-tools docs configrenders config referenceost-tools docs unknownexits 1 with available topics listedost-tools validate <space>withtypeInference: { mode: "folder-name" }in config infers type from leaf directory